package scatter.comment.rest.hierarchical.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import scatter.comment.rest.CommentConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
import org.springframework.web.bind.annotation.RestController;
import scatter.common.rest.controller.BaseAddUpdateQueryFormController;
import scatter.comment.pojo.hierarchical.po.CommentHierarchicalPic;
import scatter.comment.pojo.hierarchical.vo.CommentHierarchicalPicVo;
import scatter.comment.pojo.hierarchical.form.CommentHierarchicalPicAddForm;
import scatter.comment.pojo.hierarchical.form.CommentHierarchicalPicUpdateForm;
import scatter.comment.pojo.hierarchical.form.CommentHierarchicalPicPageQueryForm;

import javax.validation.Valid;
/**
 * <p>
 * 评论层级评论图片表 前端控制器
 * </p>
 *
 * @author yw
 * @since 2021-02-09
 */
@Api(tags = "评论层级评论图片相关接口")
@RestController
@RequestMapping(CommentConfiguration.CONTROLLER_BASE_PATH + "/hierarchical/comment-hierarchical-pic")
public class CommentHierarchicalPicController extends BaseAddUpdateQueryFormController<CommentHierarchicalPic, CommentHierarchicalPicVo, CommentHierarchicalPicAddForm, CommentHierarchicalPicUpdateForm, CommentHierarchicalPicPageQueryForm> {


     @Override
	 @ApiOperation("添加评论层级评论图片")
     @PreAuthorize("hasAuthority('CommentHierarchicalPic:add')")
     @PostMapping
     @ResponseStatus(HttpStatus.CREATED)
     public CommentHierarchicalPicVo add(@RequestBody @Valid CommentHierarchicalPicAddForm addForm) {
         return super.add(addForm);
     }

     @Override
	 @ApiOperation("根据ID查询评论层级评论图片")
     @PreAuthorize("hasAuthority('CommentHierarchicalPic:queryById')")
     @GetMapping("/{id}")
     @ResponseStatus(HttpStatus.OK)
     public CommentHierarchicalPicVo queryById(@PathVariable String id) {
         return super.queryById(id);
     }

     @Override
	 @ApiOperation("根据ID删除评论层级评论图片")
     @PreAuthorize("hasAuthority('CommentHierarchicalPic:deleteById')")
     @DeleteMapping("/{id}")
     @ResponseStatus(HttpStatus.NO_CONTENT)
     public boolean deleteById(@PathVariable String id) {
         return super.deleteById(id);
     }

     @Override
	 @ApiOperation("根据ID更新评论层级评论图片")
     @PreAuthorize("hasAuthority('CommentHierarchicalPic:update')")
     @PutMapping
     @ResponseStatus(HttpStatus.CREATED)
     public CommentHierarchicalPicVo update(@RequestBody @Valid CommentHierarchicalPicUpdateForm updateForm) {
         return super.update(updateForm);
     }

    @Override
	@ApiOperation("不分页查询评论层级评论图片")
    @PreAuthorize("hasAuthority('CommentHierarchicalPic:getList')")
    @GetMapping("/getList")
    @ResponseStatus(HttpStatus.OK)
    public List<CommentHierarchicalPicVo> getList(CommentHierarchicalPicPageQueryForm listPageForm) {
         return super.getList(listPageForm);
    }

    @Override
	@ApiOperation("分页查询评论层级评论图片")
    @PreAuthorize("hasAuthority('CommentHierarchicalPic:getPage')")
    @GetMapping("/getPage")
    @ResponseStatus(HttpStatus.OK)
    public IPage<CommentHierarchicalPicVo> getPage(CommentHierarchicalPicPageQueryForm listPageForm) {
         return super.getPage(listPageForm);
    }
}
